﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
using System.Globalization;

using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.Taxonomy;
using Microsoft.Office.Server.UserProfiles;
using Microsoft.Office.DocumentManagement.DocumentSets;

using JobCreateInDocs_DLL;

namespace JobCreateInDocs2
{
    [Guid("EEAC0689-5D22-40F5-A5EA-3552580C70ED")]
    public class JobCreateInDocs : SPJobDefinition
    {
        #region Propertys
        private string _DisplayName =
  @"(Ko) Import new documents (bill), ver. 1.0.0.14";
        public override string DisplayName
        {
            get
            {
                return _DisplayName;
            }
        }
        private string _Description =
  @"(Ko) Импорт новых накладных. Загружаются из AXAPTA через заданное время по таймеру. "
+ @"Настройка коннекта к базе и глубина выборки в днях находятся к глобальных настройках Ko";
        public override string Description
        {
            get
            {
                return _Description;
            }
        }
        #endregion Propertys
        #region Members
        string sUrl = "http://localhost";
        string sWeb = "/shops/";
        string sListName = "Первичные документы";
        #endregion #region Members
        #region Constructors
        public JobCreateInDocs() : base()
        {
            this.Title = _DisplayName;
        }
        public JobCreateInDocs(string jobName, SPService service, SPServer server, SPJobLockType targetType) : base(jobName, service, server, targetType)
        {
            this.Title = _DisplayName;
        }
        public JobCreateInDocs(string jobName, SPWebApplication webApplication) : base(jobName, webApplication, null, SPJobLockType.ContentDatabase)
        {
            this.Title = _DisplayName;
        }
        #endregion Constructors
        #region Common Methods
        static public string StringConvertName(String mName)
        {
            return mName.Replace("\"", "'"); ;
        }
        #endregion Common Methods
        #region Job Methods
        public Exception Execute(Guid contentDbId, string siteStr)
        {
            Exception ret = JobCreateInDocs_DLL.JobCreateInDocs_DLL.Execute(contentDbId, siteStr, this);
            return ret;
        }
        public override void Execute(Guid contentDbId)
        {
            Exception err = Execute(contentDbId, "http://localhost");
            string DomainNameStr = KoEnvironment.GetAppSetting("DomainName");
        }
        #endregion Job Methods
    }

    
}
